package problem153_Find_Minimum_in_Rotated_Sorted_Array;

public class Solution {
	public int findMin(int[] nums) {
    	int left=0,right=nums.length-1;
    	while(left<right){
    		int mid=left+right>>1;
    		if(nums[mid]>nums[right]){
    			left=mid+1;
    		}else{
    			right=mid;
    		}
    	}
    	return nums[left];
    }
	
	public int findMin2(int[] nums) {
    	int left=0,right=nums.length-1;
    	while(left<right){
    		int mid=left+right>>1;
    		if(nums[mid]>nums[right]){
    			left=mid+1;
    		}else if(nums[mid]<nums[right]){
    			right=mid;
    		}else{
    			right--;
    		}
    	}
    	return nums[left];
    }
}
